package com.wlz.pipeline.server.outB;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelOutboundHandlerAdapter;
import io.netty.channel.ChannelPromise;

public class NettyOutEBoundHandler extends ChannelOutboundHandlerAdapter {

    @Override
    public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {
        System.out.println("进入到出站处理器 out E");
        ctx.write(msg);
    }

    @Override
    public void read(ChannelHandlerContext ctx) throws Exception {
        System.out.println("NettyOutEBoundHandler read()");
        super.read(ctx);
//        ctx.channel().writeAndFlush(buffer);
        /*
        通常的outbindhandler实现read方法用于拦截协议校验或者安全校验等功能，
       通过拦截调用super.read，否则直接给客户端返回数据，
        */
    }
}
